import http from "@/http";
//  查询商品
export const ApiGetProductList = (
  params: any
): RES<ITableResult<IProductModel>> => http.get("/product/list", { params });
// 模糊查询
export const ApiGetProductSimpleList = (
  params: any
): RES<ITableResult<IProductModel>> => http.get("/product/simpleList", { params });
// 所有一级分类及子分类
export const ApiGetProductCategoryWithChildren = (): RES<IProductCategoryWithChildren[]> => http.get("/productCategory/list/withChildren");
// 获取全部品牌列表
export const ApiGetBrandListAll = (): RES<IBrandList[]> => http.get(`/brand/listAll`);
// 搜索Sku
export const ApiGetSku = (pid: number, keyword: string): RES<ISku[]> => http.get(`/sku/${pid}?keyword=${keyword}`,);
// 批量更新sku
export const ApiUpDataSku = (pid: number, skuStockList: ISku[]): RES<[]> => http.post(`sku/update/${pid}?skuStockList=${skuStockList}`,);
// 修改商品属性信息
export const ApiUpDataProductAttr = (params: any): RES<[]> => http.post(`/productAttribute/update/{id}`, params);
// 获取商品信息
export const ApiGetProductById = (id: number): RES<IProductAttr> => http.get(`/product/updateInfo/${id}`);
// 列表删除商品
export const ApiDeleteProductAttr = (ids: number[], deleteStatus: number): RES<null> => http.post(`/product/update/deleteStatus?ids=${ids}&deleteStatus=${deleteStatus}`);
// 列表设置新品
export const ApiNewStatus = (ids: number[], newStatus: number): RES<null> => http.post(`/product/update/newStatus?ids=${ids}&newStatus=${newStatus}`);
// 列表上架
export const ApiPublishStatus = (ids: number[], publishStatus: number): RES<null> => http.post(`/product/update/publishStatus?ids=${ids}&publishStatus=${publishStatus}`);
// 列表推荐
export const ApiRecommendStatus = (ids: number[], recommendStatus: number): RES<null> => http.post(`/product/update/recommendStatus?ids=${ids}&recommendStatus=${recommendStatus}`);
// 查询分类
export const ApiGetProductCategoryList = (params: any): RES<ITableResult<IProductModel>> => http.get(`productCategory/list/${params.parentId}`, { params });
// 分类显示
export const ApiShowStatus = (ids: number[], showStatus: number): RES<null> => http.post(`/productCategory/update/showStatus?ids=${ids}&showStatus=${showStatus}`);
// 分类导航栏
export const ApiNavStatus = (ids: number[], navStatus: number): RES<null> => http.post(`/productCategory/update/navStatus?ids=${ids}&navStatus=${navStatus}`);
//获取单个分类
export const ApiGetProductCategoryById = (id: number): RES<Child> => http.get(`/productCategory/${id}`);
// 删除分类
export const ApiDeleteProductCategory = (id: number): RES<null> => http.post(`/productCategory/delete/${id}`);
// 添加分类
export const ApiAddProductCategory = (params: productCategoryParam): RES<null> => http.post(`/productCategory/create`, params);
// 获取属性列表
export const ApiGetProductCategoryWithAttr = (): RES<IProductAttr[]> => http.get(`/productAttribute/category/list/withAttr`);
//编辑分类
export const ApiEditProductCategory = (id: number, params: productCategoryParam): RES<null> => http.post(`/productCategory/update/${id}`, params);
// 根据商品分类的id获取商品属性及属性分类
export const ApiGetProductAttributeById = (productCategoryId: number): RES<productCategoryAndAttributeId[]> => http.get(`/productAttribute/attrInfo/${productCategoryId}`);
// 添加商品
export const ApiAddProduct = (params: IProductParam): RES<null> => http.post(`/product/create`, params);
// 分页获取属性分类列表
export const ApiGetProductAttributeCategoryList = (params: any): RES<ITableResult<ProductAttributeCategoryList>> => http.get(`/productAttribute/category/list`, { params });
// 分页id获取属性
export const ApiGetProductAttributeListById = (cid: number, type: number): RES<ITableResult<IProductAttribute>> => http.get(`productAttribute/list/${cid}?pageNum=1&pageSize=100&type=${type}`,);
// 获取专题
export const ApiGetSubject = (): RES<ISubject[]> => http.get('/subject/listAll');
//获取优选
export const ApiGetPrefrenceArea = (): RES<IPrefrenceArea[]> => http.get('/prefrenceArea/listAll');
// 更新商品
export const ApiUpdateProduct = (id: number, params: IProductParam): RES<[]> => http.post(`/product/update/${id}`, params);












